package com.test.ReaderDemo;

import org.junit.Test;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;

/**
 * ${DESCRIPTION}
 *
 * @author muxiaoyu
 * @create 2017/06/08 10:04
 **/
public class ReaderDemo {
    public static void main(String[] args) throws Exception {
        FileWriter writer = new FileWriter(new File("d:\\1.dat"));
        writer.write("hello world");
        writer.close();

    }

    @Test
    public void test777() throws Exception {
        FileReader fileReader = new FileReader(new File("d:\\1.dat"));
        char[] cbuf = new char[32];
        int hasread = 0;
        while ((hasread = fileReader.read(cbuf)) != -1) {
            System.out.println(new String(cbuf, 0, hasread));

        }
        fileReader.close();
    }
}
